const testData = [
  {
    name: "阿张三",
    height: 175,
    age: 22,
    gender: "男",
    weight: 70,
    scores: {
      Chinese: 80,
      Math: 90,
      English: 85,
    },
    rank: 3,
  },
  {
    name: "李四",
    height: 168,
    age: 20,
    gender: "男",
    weight: 60,
    scores: {
      Chinese: 85,
      Math: 78,
      English: 92,
    },
    rank: 1,
  },
  {
    name: "不王五",
    height: 162,
    age: 19,
    gender: "女",
    weight: 50,
    scores: {
      Chinese: 90,
      Math: 88,
      English: 92,
    },
    rank: 2,
  },
  {
    name: "赵六",
    height: 170,
    age: 21,
    gender: "男",
    weight: 72,
    scores: {
      Chinese: 70,
      Math: 80,
      English: 75,
    },
    rank: 5,
  },
  {
    name: "钱七",
    height: 165,
    age: 20,
    gender: "女",
    weight: 55,
    scores: {
      Chinese: 78,
      Math: 92,
      English: 85,
    },
    rank: 4,
  },
];
testData.sort((a, b) => {
  console.log(b.name.codePointAt(0));
  return a.name.codePointAt(0) - b.name.codePointAt(0);
});
console.log(testData);
// let obj = {};
// let index = -1;
// testData.forEach((item) => {
//   index = Math.floor(item.age / 10);
//   if (!obj[index]) {
//     obj[index] = {
//       count: item.weight,
//       num: 1,
//     };
//   } else {
//     obj[index].count += item.weight;
//     obj[index].num++;
//   }
// });
// console.log(obj);
